import request from '@/utils/request'

// 分页查询
export const GetMajorListByPage = (pageNum, pageSize, queryDto) => {
    return request({
        url: '/admin/school/major/findByPage/' + pageNum + '/' + pageSize,
        method: 'get',
        params: queryDto,
    })
}

// 新增用户的方法
export const SaveMajor = data => {
    return request({
        url: '/admin/school/major/saveMajor',
        method: 'post',
        data: data,
    })
}

// 修改用户数据的方法
export const UpdateMajor = major => {
    return request({
        url: '/admin/school/major/updateMajor',
        method: 'put',
        data: major,
    })
}

// 根据id删除用户
export const DeleteMajorById = majorId => {
    return request({
        url: '/admin/school/major/deleteMajorById/' + majorId,
        method: 'delete',
    })
}

// 获取当前学院所有专业
export const GetMagorListByCollegeId = collegeId => {
    return request({
        url: '/admin/school/major/getMajorListByCollegeId',
        method: 'get',
        params: {collegeId: collegeId}
    });
}


export const DoAssignCourse = (majorId, courseIds) => {
    const params = courseIds.join(',');
    return request({
        url: '/admin/school/major/doAssignCourse/' + majorId,
        method: 'put',
        params: {courseIds: params}
    })
}

export const GetCheckCollege = (majorId) => {
    return request({
        url: '/admin/school/major/getCheckCollege/' + majorId,
        method: 'get',
    })
}

export const GetCourseByMajoeId = majorId => {
    return request({
        url: '/admin/school/major/getCourseByMajoeId/' + majorId,
        method: 'get',
    })
}
export const UpdateCourseMajor = courseMajor => {
    return request({
        url: '/admin/school/major/updateCourseMajor',
        method: 'put',
        data: courseMajor,
    })
}